atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
733 stars 269 forks source link

Compile/Run Through Terminal/cmd #743

Open ghost opened 8 years ago

ghost commented 8 years ago

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"
nixel2007 commented 8 years ago

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

rgbkrk commented 8 years ago

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

ghost commented 8 years ago

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.

rgbkrk commented 8 years ago

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.

ghost commented 8 years ago

thank you very much!

ghost commented 8 years ago

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

rgbkrk commented 8 years ago

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

ghost commented 8 years ago

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.

rgbkrk commented 8 years ago

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.

stormherz commented 8 years ago

@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?)

rgbkrk commented 8 years ago

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

nixel2007 commented 8 years ago

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

rgbkrk commented 8 years ago

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!

stormherz commented 8 years ago

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

ghost commented 8 years ago

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.

Ninja2k commented 7 years ago

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,