You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im looking to return control back to the calling function with text for proper child_process calls.
It seems if I call a child process WITHIN react, I loose the text cursor, | for some reason.
However if I pass a string back out to the calling function, outside of the react scope, then the child_process call will show the cursor.
Its fine if that is required, however to get text back out to the calling function requires calling exit(new Error('text to return'))
and catching the "error" with waitUntilExit.catch().
In this use case, the returned text is not an error, which makes my approach seem like a hack.
Is there a better way to pass text back out of react and still have all the react side effects fully functioning?
I do not need this to be synchronous like #459 is requiring.
function AwsEcs () {
const { exit } = useApp();
useEffect(() => {
// ... use inputs to select values, etc before we get here ...
exit(new Error('aws ecs execute-command ...')); // send the `aws ecs` command string back to the calling function
// execSync('aws ecs execute-command ...', { stdio: "inherit" }) <-- Cannot call child process here else we looses the text cursor
});
return ... ;
}
const { waitUntilExit } = render(createElement(AwsEcs));
waitUntilExit()
.then((output) => console.log('output', output)) // `output` is undefined. It would be nice to pass text to here for non-errors.
.catch(error => execSync(error.message, { stdio: "inherit" })); // `error.message` has the exit value and this child process has the cursor. But it seems hacky to pass text to the catch method.
The text was updated successfully, but these errors were encountered:
Im looking to return control back to the calling function with text for proper child_process calls.
It seems if I call a child process WITHIN react, I loose the text cursor,
|
for some reason.However if I pass a string back out to the calling function, outside of the react scope, then the child_process call will show the cursor.
Its fine if that is required, however to get text back out to the calling function requires calling
exit(new Error('text to return'))
and catching the "error" with
waitUntilExit.catch()
.In this use case, the returned text is not an error, which makes my approach seem like a hack.
Is there a better way to pass text back out of react and still have all the react side effects fully functioning?
I do not need this to be synchronous like #459 is requiring.
The text was updated successfully, but these errors were encountered: