commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (EXEC-67) Shell (-c) command execution - fire and forget
Date Tue, 25 Sep 2012 16:38:07 GMT

     [ https://issues.apache.org/jira/browse/EXEC-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved EXEC-67.
----------------------

    Resolution: Invalid

JIRA is not a support forum.

Please subscribe to the Commons user list and ask there.
                
> Shell (-c) command execution - fire and forget
> ----------------------------------------------
>
>                 Key: EXEC-67
>                 URL: https://issues.apache.org/jira/browse/EXEC-67
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: OS: Mac OS X 10.7.4
> Java version: "1.6.0_35"
>            Reporter: Stuart Broad
>              Labels: -c, sh
>
> I am attempting to 'fire and forget' a process.  Using java ProcessBuilder I can do this
as follows:
> ProcessBuilder pb = new ProcessBuilder("sh", "-c", "nohup ping -c 20 localhost > /dev/null
2>&1 &");
> ...
> Running using Commons Exec I get the following error:
> sh: nohup ping -c 20 localhost > /dev/null 2>&1 &: No such file or directory
> The stripped down code is as follows:
>         ...
>         DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
>         PumpStreamHandler psh = new PumpStreamHandler(logHandler);
>         CommandLine cl = CommandLine.parse("sh");
>         cl.addArgument("-c");
>         cl.addArgument("nohup ping -c 20 localhost > /dev/null 2>&1 &");
>         DefaultExecutor exec = new DefaultExecutor();
>         mWatchDog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT);
>         exec.setStreamHandler(psh);
>         exec.setWatchdog(mWatchDog);
>         exec.execute(cl, resultHandler);
>         ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message