atom-script icon indicating copy to clipboard operation
atom-script copied to clipboard

Compile/Run Through Terminal/cmd

Open ghost opened this issue 10 years ago • 16 comments

I'm not familiar with your code but is there a way to change it so Atom doesn't capture the input and instead the file opens a new terminal/cmd prompt and compiles/runs inside that. I've been having issues trying to run code in Atom for programs that require user input and for some functions that return text not encoded using utf-8 which causes errors when atom tries to capture the terminal input.

So is there a way to modify the code so it prompts terminal/cmd to open up and execute a command like Open terminal/cmd then execute

  1. "javac file.java"
  2. "java file" or for python
  3. "python file.py"

ghost avatar Jan 17 '16 07:01 ghost

I think we need a boolean parameter in build config (at grammars.coffee and at config window), like shell: true. So devs can specify where their code must be executed.

Maybe we can get some useful code from the build package - it have this functionality.

/cc @rgbkrk

nixel2007 avatar Jan 17 '16 09:01 nixel2007

Yeah there's no problem with shelling out to open a brand new terminal. How about if the checkbox is:

  • [ ] Open in new terminal

rgbkrk avatar Jan 17 '16 19:01 rgbkrk

Yeah, that would work. I'm guessing what I am asking is, is there anything I can do that would be a quick simple change that would allow me to edit the code my self? I'm not familiar with coffeescript.

ghost avatar Jan 17 '16 20:01 ghost

At the moment I don't think it's a quick simple change, especially cross platform.

I'm happy to help you start hacking on this package though in the coming week.

rgbkrk avatar Jan 17 '16 20:01 rgbkrk

thank you very much!

ghost avatar Jan 18 '16 01:01 ghost

When can I expect this to be done? Not to rush you or anything just would like an estimate if possible. :) @rgbkrk

ghost avatar Jan 25 '16 06:01 ghost

Whoop! Do you have a good time today for a video chat and screenshare to pair on this?

rgbkrk avatar Jan 25 '16 16:01 rgbkrk

I haven't used coffeescript before. Maybe I made in unclear, I'm new to using github. I was wondering if it was a feature you could implement. I mean I would learn coffeescript, but I don't know how I would be of help to you? @rgbkrk or maybe I am misunderstanding you? sorry.

ghost avatar Jan 25 '16 20:01 ghost

Well, I was primarily saying that I'd love to help you learn how to work with this code base. This isn't a feature I want to devote any time to right now based on priorities and current workload. I'm always happy to donate a little bit of time in helping others learn though.

rgbkrk avatar Jan 25 '16 20:01 rgbkrk

@rgbkrk I guess I could implement this (for example, we could place such optional checkbox in run options dialog and add global setting checkbox, which will allow running in external terminal on every script run), though there is a few questions pending - how can we determine terminal in a cross-platform way (specify in settings? guess by os?)

stormherz avatar Jan 26 '16 10:01 stormherz

That's definitely a can of worms. You can switch based on the OS, and at least got Windows check to see if powershell exists before launching cmd.exe

Not sure how you would know for some of the other operating systems honestly. Maybe this is a matter of specifying this as an arg to script options

rgbkrk avatar Jan 27 '16 01:01 rgbkrk

There is some OS-checks In grammars.coffee, see "C" for example. Isn't this enough?

nixel2007 avatar Jan 27 '16 06:01 nixel2007

Oh I mean the can of worms is in the launching of a terminal. I could be way wrong and I'd prefer that I am. :wink: If you're happy to code on this one, I'd love to see it!

rgbkrk avatar Jan 27 '16 06:01 rgbkrk

Well, I'll start then and we'll see where it's coming =)

stormherz avatar Jan 27 '16 07:01 stormherz

how can I input as a user while running a java program ? For example if the code is - import java.util.*; public class h { public static void main(String[] args) { Scanner ob=new Scanner(System.in); System.out.println("enter a number"); int i=ob.nextInt(); System.out.println("hello"+i); } }

on applying shift+ctrl+b the program runs but I am not able to enter any input.

Please help.

ghost avatar Jun 18 '16 07:06 ghost

Textpad does it well, for Java it just calls the default command shell on Windows, this way every type of command is supported since they are built for use by the default shell,

BarryK2026 avatar Nov 09 '16 22:11 BarryK2026