[ 
https://issues.apache.org/jira/browse/MESOS-4549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388704#comment-16388704
 ] 

Andrew Schwartzmeyer commented on MESOS-4549:
---------------------------------------------

As of

commit 330ddcb51
Author: Akash Gupta akash-gu...@hotmail.com
Date:   Tue Mar 6 13:11:21 2018 -0800

Changed `os::system()` to return `Option<int>` instead of `int`.

The `os::system()` function returned `-1` on error, which is a valid
exit code on Windows, e.g., `os::system("exit -1")`, so it was
impossible to distinguish a failure from a process returning `-1`.
With `Option<int>`, failures will return as `None()`.

Review: https://reviews.apache.org/r/65841/

{{os::system}} now returns an {{Option<int>}}, as {{Try}} isn't usable since it 
uses {{std::string}} for {{Error}}, which isn't async signal safe.

> Consider returning `Try` for `os::system`.
> ------------------------------------------
>
>                 Key: MESOS-4549
>                 URL: https://issues.apache.org/jira/browse/MESOS-4549
>             Project: Mesos
>          Issue Type: Task
>          Components: stout
>            Reporter: Michael Park
>            Priority: Minor
>
> The {{os::system}} has the following description:
> {code}
> // Executes a command by calling "/bin/sh -c <command>", and returns
> // after the command has been completed. Returns 0 if succeeds, and
> // return -1 on error (e.g., fork/exec/waitpid failed). This function
> // is async signal safe. We return int instead of returning a Try
> // because Try involves 'new', which is not async signal safe.
> inline int system(const std::string& command);
> {code}
> Since {{Try}} no longer involves dynamic allocations, we can reconsider 
> returning a {{Try}} out of this function.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to