Skip to content

ffi issues #4255

Answered by DaniPopes
sakulstra asked this question in Q&A
Discussion options

You must be logged in to vote

The > text.txt is not part of the call to printf, it's a sh builtin: you're executing the command printf with 3 arguments, which fails. Same goes for expansions: $(...)
You would have to wrap the printf with a sh / bash command like so:
sh -c "printf hello > test.txt":

string[] memory inputs = new string[](4);
inputs[0] = "sh";
inputs[1] = "-c";
inputs[2] = "printf hello > test.txt";
vm.ffi(inputs);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sakulstra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants