exeggutor 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/exeggutor.rb +20 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b9eb0de91468b1ba1d04da72cac44b57eaadd3553719d86910d71f88af67746
4
- data.tar.gz: 77713dec1ae04c17322d25563abf517dc406c34f61661e1fd483abf9a307f123
3
+ metadata.gz: 1ef72410040189a5e3d92f9112a65ddf167d08196047136da03e5471fbce10c6
4
+ data.tar.gz: 2767a58074b611c9b47448313f1eb483648b8b81336fd7e49998cece6ca11ed6
5
5
  SHA512:
6
- metadata.gz: edfbd0cbe10c2b38812b8a92adfa91566cdd5f4823a4d4e9030a516c7b0c352c465796c7c30b78744db33501d3cf832acf1570076aa47a1db0826621a5d0ab16
7
- data.tar.gz: a7bdcd0f7f915dfce050b7cb84ec3ffe92ac46304524e2f51440eeef02417209458f35562256b7e74807795501d893a24eed97cf947481686d5f7bd3a1c7e064
6
+ metadata.gz: a681829d986c9466675547079d53d90420e9a26b1cf71ce7987a48c766e3400510009595e6e8dec6c73e15b20c2a618e3233367c47827ecfa53ebe8b040a6149
7
+ data.tar.gz: '0329cd3a8c536474c5a2090c7a1f049c01c571b9d6038fe013fe9946277884587fef568839f70303c813869c05a510da0f323eeb24ce1b1dbdceefa101dc1e67'
data/lib/exeggutor.rb CHANGED
@@ -40,6 +40,7 @@ module Exeggutor
40
40
 
41
41
  # @private
42
42
  def self.run_popen3(args, env)
43
+ # Use this weird [args[0], args[0]] thing for the case where a command with just one arg is being run
43
44
  if env
44
45
  Open3.popen3(env, [args[0], args[0]], *args.drop(1))
45
46
  else
@@ -47,20 +48,6 @@ module Exeggutor
47
48
  end
48
49
  end
49
50
 
50
- # Executes a command with the provided arguments and options
51
- #
52
- # @param args [Array<String>] The command and its arguments as an array.
53
- # @param can_fail [Boolean] If false, raises a ProcessError on failure.
54
- # @param show_stdout [Boolean] If true, prints stdout to the console in real-time.
55
- # @param show_stderr [Boolean] If true, prints stderr to the console in real-time.
56
- # @param cwd [String, nil] The working directory to run the command in. If nil, uses the current working directory.
57
- # @param stdin_data [String, nil] Input data to pass to the command's stdin. If nil, doesn't pass any data to stdin.
58
- # @param env_vars [Hash{String => String}, nil] A hashmap containing environment variable overrides,
59
- # or `nil` if no overrides are desired
60
- #
61
- # @return [ProcessResult] An object containing process info such as stdout, stderr, and exit code. Waits for the command to complete to return.
62
- #
63
- # @raise [ProcessError] If the command fails and `can_fail` is false.
64
51
  def self.run!(args, can_fail: false, show_stdout: false, show_stderr: false, env: nil, cwd: nil, stdin_data: nil)
65
52
  # TODO: expand "~"? popen3 doesn't expand it by default
66
53
  if cwd
@@ -72,7 +59,10 @@ module Exeggutor
72
59
  stdin_stream.write(stdin_data) if stdin_data
73
60
  stdin_stream.close
74
61
 
75
- stderr_stream.sync = true # Match terminals more closely
62
+ # Make the streams as synchronous as possible, to minimize the possibility of a surprising lack
63
+ # of output
64
+ stdout_stream.sync = true
65
+ stderr_stream.sync = true
76
66
 
77
67
  stdout_str = +'' # Using unfrozen string
78
68
  stderr_str = +''
@@ -103,7 +93,7 @@ module Exeggutor
103
93
  # Close open pipes
104
94
  stdout_stream.close
105
95
  stderr_stream.close
106
-
96
+
107
97
  result = ProcessResult.new(
108
98
  stdout: stdout_str.force_encoding('UTF-8'),
109
99
  stderr: stderr_str.force_encoding('UTF-8'),
@@ -124,6 +114,20 @@ module Exeggutor
124
114
  end
125
115
  end
126
116
 
117
+ # Executes a command with the provided arguments and options
118
+ #
119
+ # @param args [Array<String>] The command and its arguments as an array.
120
+ # @param can_fail [Boolean] If false, raises a ProcessError on failure.
121
+ # @param show_stdout [Boolean] If true, prints stdout to the console in real-time.
122
+ # @param show_stderr [Boolean] If true, prints stderr to the console in real-time.
123
+ # @param cwd [String, nil] The working directory to run the command in. If nil, uses the current working directory.
124
+ # @param stdin_data [String, nil] Input data to pass to the command's stdin. If nil, doesn't pass any data to stdin.
125
+ # @param env_vars [Hash{String => String}, nil] A hashmap containing environment variable overrides,
126
+ # or `nil` if no overrides are desired
127
+ #
128
+ # @return [ProcessResult] An object containing process info such as stdout, stderr, and exit code. Waits for the command to complete to return.
129
+ #
130
+ # @raise [ProcessError] If the command fails and `can_fail` is false.
127
131
  def run!(...)
128
132
  Exeggutor::run!(...)
129
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exeggutor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Eisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-23 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest