-
Notifications
You must be signed in to change notification settings - Fork 287
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
Suggestion: about temporary file #338
Comments
Are you running it in terminal? If not in terminal, it should be removed. |
@formulahendry Yeah, I'm running it in terminal. |
OK, for now, you could customize the |
@formulahendry Could you give an example? |
@formulahendry I've read this, but sorry for that I have no idea about how to determine whether it's running a temporary file. 😢 Could it read the |
You could just use $fullFileName or $fileName, e.g. `"python": "python $fullFileName && del $fullFileName". And, currently it is no support to set globally. |
@formulahendry Thanks a lot, but... this would make an unconditional removal, whether it's the temporary file created by running selected code or not. TAT |
Oh... You are right... |
Or just use something like |
@formulahendry Thanks! (To be honest, I've been using in this way before opening this issue :P |
I was also trying to find a workaround/solution for this situation. I can do |
For those interested, this is how my
Notes:
It works but there are a few things to keep in mind when doing it manually. |
It is not deleting the temp files for me whether it is run in Output or Terminal. They always persist. Doesn't matter which language either. In order for them to delete, I must use the mappings like above with a 'rm tempCodeRunnerFile.' command at the end. |
also not getting removed for me with or without "Run in Terminal" |
Why not just create those temp files in system temp dir? |
@cherry-geqi the file system environment often matters even for snippets. Mostly for imports, but sometimes for global definitions. |
As far as I know, many executors accept scripts from stdin. node /path/to/script.js We can node < /path/to/script.js This will avoid the env issues. |
That's a great idea! |
@cherry-geqi Sounds good, but it's not a robust way... |
I know it's a bit late, but since this issue is still open ... therefore tinkered a bit around and made this work: |
Amazing that not more people are complaining about this - I had no idea what was generating these files and finally Googled the filename. There should definitely be an option to delete the temporary file if running via a console - temporary files are just that so why keep them after executing? |
Following up on filipesilva's answer above, anyone facing this issue on linux and running on terminal may try this:
|
sorry to necro, but i didn't like the above solutions, so i forked the project and changed a few lines to allow entire paths for the if anyone is interested: https://github.com/ericchase/fork--vscode-code-runner |
Currently, after running selected code in Code Runner, it leaves a temporary file with the name set in
code-runner.temporaryFileName
in working dir. If we don't need that any more, we have to remove it manually.What about adding a setting about whether the temporary file would be removed automatically after running?
The text was updated successfully, but these errors were encountered: