Skip to content

Commit

Permalink
Update adding_external_tool_backend.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NoxNovus authored Nov 7, 2024
1 parent 6176b4a commit b5c9864
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/adding_external_tool_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,21 @@ You should add an endpoint for your backend tool here. The endpoint will look so
const safe_input = input.<YOUR_TOOL_INPUT>.replace(/'/g, "\\'");
try {
// The most important line is this next one. Include anything you need to run your executable or binary from the command line, and exec will run it from the command line as a command.
// Note that if your tool needs multiple commands to run, you will need multiple exec statements here
const { stdout, stderr } = await exec(
`cd ${odysseyDir} && .${<YOUR_TOOL_PATH>.replace(odysseyDir, '')} <(printf '${safe_input}')`,
{ shell: '/bin/bash' }
);
// Define some string to be the returned result of your tool to send as a response from your endpoint.
res.json({ stdout: `<(printf "${stdout}")` });
} catch (e) {
console.error(e);
}
})
```



The existing FPTaylor and FPBench endpoints serve as good examples to guide your implementation.


Expand Down

0 comments on commit b5c9864

Please sign in to comment.