[arquillian-issues] [JBoss JIRA] (ARQ-1841) Spacelift can not deal with background process invocation

Karel Piwko (JIRA) issues at jboss.org
Thu Mar 19 05:15:23 EDT 2015


    [ https://issues.jboss.org/browse/ARQ-1841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051679#comment-13051679 ] 

Karel Piwko commented on ARQ-1841:
----------------------------------

[~smikloso] thinking about this problem, if you know this is happening, you might want not to call await() and set process to run as daemon. This should make the behavior the same as Runtime#exec(String)

> Spacelift can not deal with background process invocation
> ---------------------------------------------------------
>
>                 Key: ARQ-1841
>                 URL: https://issues.jboss.org/browse/ARQ-1841
>             Project: Arquillian
>          Issue Type: Bug
>          Components: Extension - Spacelift
>    Affects Versions: spacelift_1.0.0.Alpha2
>            Reporter: Stefan Miklosovic
>
> Let's have this simple script:
> {code:title=run_agent_bg.sh|borderStyle=solid}
> #!/bin/sh
> curpath=`dirname $0`
> nohup ${curpath}/run_agent.sh $@ > /dev/null & 2>&1
> {code}
> I execute it like this:
> {code:title=App.java|borderStyle=solid}
> public class App {
>     public static void main(String[] args) throws IOException {
>         Tasks.setDefaultExecutionServiceFactory(new DefaultExecutionServiceFactory());
>         System.out.println("before");
>         Tasks.prepare(CommandTool.class)
>             .programName("/bin/bash")
>             .parameters("-c", "/tmp/ngrinder-agent/ngrinder-agent/run_agent_bg.sh")
>             .execute().await();
>         
>         System.out.println("after");
>     }
> }
> {code}
> So it effectively does this:
> {code}
> /bin/bash -c "/tmp/ngrinder-agent/ngrinder-agent/run_agent_bg.sh"
> {code}
> However it never reaches "after" output, that process in the script is started but Spacelift does not send it to the background and it still waits untill it is finished which never happen.
> Executing that script directly like following does the job:
> {code:title=App.java|borderStyle=solid}
> public class App {
>     public static void main(String[] args) throws IOException {
>         Tasks.setDefaultExecutionServiceFactory(new DefaultExecutionServiceFactory());
>         System.out.println("before");
>         Runtime.getRuntime().exec("/tmp/ngrinder-agent/ngrinder-agent/run_agent_bg.sh");
>         
>         System.out.println("after");
>     }
> }
> {code}
> Started process survives JVM termination.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the arquillian-issues mailing list