Skip to content
Snippets Groups Projects
Commit 2a51abc1 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

parser_write:fix shebang for oneshot in case of custom build

parent cf244f36
No related branches found
No related tags found
No related merge requests found
......@@ -868,9 +868,17 @@ int write_exec(sv_alltype *sv, sv_exec *exec,char const *file,char const *dst,in
}
break ;
case CUSTOM:
if (!stralloc_cats(&shebang, "#!")) retstralloc(0,"write_exec") ;
if (!stralloc_cats(&shebang, keep.s+exec->shebang)) retstralloc(0,"write_exec") ;
if (!stralloc_cats(&shebang,"\n")) retstralloc(0,"write_exec") ;
if (type != ONESHOT)
{
if (!stralloc_cats(&shebang, "#!")) retstralloc(0,"write_exec") ;
if (!stralloc_cats(&shebang, keep.s+exec->shebang)) retstralloc(0,"write_exec") ;
if (!stralloc_cats(&shebang,"\n")) retstralloc(0,"write_exec") ;
}
else
{
if (!stralloc_cats(&shebang, keep.s+exec->shebang)) retstralloc(0,"write_exec") ;
if (!stralloc_cats(&shebang," \\\n\"")) retstralloc(0,"write_exec") ;
}
break ;
default:
VERBO3 strerr_warnw3x("unknow ", get_keybyid(exec->build)," build type") ;
......@@ -884,6 +892,10 @@ int write_exec(sv_alltype *sv, sv_exec *exec,char const *file,char const *dst,in
if (!stralloc_0(&shebang)) retstralloc(0,"write_exec") ;
/** close command */
if (!stralloc_cats(&runuser, keep.s+exec->exec)) retstralloc(0,"write_exec") ;
if (type == ONESHOT)
{
if (!stralloc_cats(&runuser," \"")) retstralloc(0,"write_exec") ;
}
if (!stralloc_cats(&runuser,"\n")) retstralloc(0,"write_exec") ;
if (!stralloc_0(&runuser)) retstralloc(0,"write_exec") ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment