-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run terminal commands #13
Comments
@okwasniewski : I tried to make it work, but I couldn't. import {spawn, kill} from 'react-native-childprocess'
useEffect(() => {
const fetchData = async () => {
cmdID = await spawn('/sbin/ping', ['google.com'], {
pwd: "/",
stdout: (output) => {
console.log('>>>', output)
}
});
console.log(cmdID)
}
fetchData()
.catch(console.error);
}, []) |
It works for me did you ran |
@okwasniewski : it stops working. |
You need to clean up the old build. Inside |
@okwasniewski : I don't understand why it's always macos from all these problems. the first time it was worth: useEffect(() => {
let cmdID;
const shell = async () => {
cmdID = await spawn('pwd', ['-LP'], {
pwd: '/Users',
stdout: (output) => {
console.log('stdout:', output);
},
stderr: (output) => {
console.log('stderr:', output);
},
terminate: (output) => {
console.log('terminate:', output);
},
});
console.log('oo:', cmdID);
};
shell().catch(console.error);
return () => {
console.log("kill")
kill(cmdID);
};
}, []); But the command written this way seems to work well, I get this:
|
See my explanation here: microsoft/react-native-macos#1937 (comment) It's not currently possible to run arbitrary node native modules with React Native macOS, as they have two completely separate methods of JS->Native (C++) communication. |
@Saadnajmi The solution for this particular issue would be to create an RN Macos library that would wrap another native library to execute shell commands like https://github.com/JohnSundell/ShellOut right? |
Yep, unless the other project I mentioned lands and we can get all node native modules to "just work" with react native macOS (while using Hermes). But you know, that's a ways away I think, and writing your own native module OS the way to go IMO |
@okwasniewski , @Saadnajmi : Maybe I managed to do something, I replied on react-native-macos. |
Hi @okwasniewski, It would be useful to be able to execute terminal-type commands, like this one here:
So I thought it would be useful to adopt a server solution like this: https://testableapple.com/gaining-access-to-command-line-from-maestro/
The text was updated successfully, but these errors were encountered: