Class: AssLauncher::Support::Shell::Script Private
- Includes:
- Platforms
- Defined in:
- lib/ass_launcher/support/shell.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
What reason for it? Reason for it:
Fucking 1C binary often unexpected parse cmd arguments if run in shell like ‘1c.exe arguments`. For correction this invented two way run 1C binary: as command see Command or as script see Script. If run 1C as command we can control executing process wait exit or kill 1C binary process. If run 1C as script 1C more correctly parse arguments but we can’t kill subprosess running in cmd.exe
On default use silient execute 1C binary whit /DisableStartupDialogs, /DisableStartupMessages parameters and capture 1C output /OUT parameter. Read message from /OUT when 1C binary process exit and build instnce of RunAssResult.
Fucking 1C not work with stdout and stderr For out 1C use /OUT“file” parameter and write message into. Message encoding ‘cp1251’ for windows and ‘utf-8’ for Linux
class Script wraping cmd string in to script tempfile and running as: popen3(‘cmd.exe’, ‘/C’, ‘tempfile’ in cygwin or windows or popen3(‘sh’, ‘tempfile’) in linux
Constant Summary
Constants inherited from Command
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#args ⇒ Array
private
Return args for run shell script.
-
#cmd ⇒ String
private
Returm shell binary ‘cmd.exe’ or ‘sh’.
-
#initialize(cmd, options = {}) ⇒ Script
constructor
private
A new instance of Script.
-
#run(options = {}) ⇒ ProcessHolder
private
Run script.
- #to_s ⇒ Object private
Methods included from Platforms
cygwin?, env, glob, linux?, path, path_class, windows?
Methods inherited from Command
#capture_assout?, #exit_handling, #running?
Constructor Details
#initialize(cmd, options = {}) ⇒ Script
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Script.
227 228 229 |
# File 'lib/ass_launcher/support/shell.rb', line 227 def initialize(cmd, = {}) super cmd, [], end |
Instance Method Details
#args ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return args for run shell script
287 288 289 290 291 292 293 |
# File 'lib/ass_launcher/support/shell.rb', line 287 def args if cygwin_or_windows? ['/C', make_script.win_string] else [make_script.to_s] end.freeze end |
#cmd ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returm shell binary ‘cmd.exe’ or ‘sh’
277 278 279 280 281 282 283 |
# File 'lib/ass_launcher/support/shell.rb', line 277 def cmd if cygwin_or_windows? 'cmd.exe' else 'sh' end end |
#run(options = {}) ⇒ ProcessHolder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run script. Script wait process exit
309 310 311 312 |
# File 'lib/ass_launcher/support/shell.rb', line 309 def run( = {}) ph = super ph.wait end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
used @cmd and @args variable for reason! In class AssLauncher::Support::Shell::Script methods #cmd and #args returns command and args for run script in sh or cmd.exe but #to_s return content for script
266 267 268 |
# File 'lib/ass_launcher/support/shell.rb', line 266 def to_s "#{@cmd} #{@args.join(' ')}" end |