Just use a single args parameter for conciseness
This commit is contained in:
parent
15582dd031
commit
a4091b4260
@ -9,14 +9,13 @@ module Utils
|
|||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
arg0: T.any(String, T::Hash[String, String]),
|
args: T.any(String, T::Hash[String, String]),
|
||||||
args: String,
|
|
||||||
safe: T::Boolean,
|
safe: T::Boolean,
|
||||||
options: Symbol,
|
options: Symbol,
|
||||||
block: T.nilable(T.proc.params(io: IO).void),
|
block: T.nilable(T.proc.params(io: IO).void),
|
||||||
).returns(String)
|
).returns(String)
|
||||||
}
|
}
|
||||||
def self.popen_read(arg0, *args, safe: false, **options, &block)
|
def self.popen_read(*args, safe: false, **options, &block)
|
||||||
output = popen(args, "rb", options, &block)
|
output = popen(args, "rb", options, &block)
|
||||||
return output if !safe || $CHILD_STATUS.success?
|
return output if !safe || $CHILD_STATUS.success?
|
||||||
|
|
||||||
@ -25,26 +24,24 @@ module Utils
|
|||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
arg0: T.any(String, T::Hash[String, String]),
|
args: T.any(String, T::Hash[String, String]),
|
||||||
args: String,
|
|
||||||
options: Symbol,
|
options: Symbol,
|
||||||
block: T.nilable(T.proc.params(io: IO).void),
|
block: T.nilable(T.proc.params(io: IO).void),
|
||||||
).returns(String)
|
).returns(String)
|
||||||
}
|
}
|
||||||
def self.safe_popen_read(arg0, *args, **options, &block)
|
def self.safe_popen_read(*args, **options, &block)
|
||||||
popen_read(*args, safe: true, **options, &block)
|
popen_read(*args, safe: true, **options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
arg0: T.any(String, T::Hash[String, String]),
|
args: T.any(String, T::Hash[String, String]),
|
||||||
args: String,
|
|
||||||
safe: T::Boolean,
|
safe: T::Boolean,
|
||||||
options: Symbol,
|
options: Symbol,
|
||||||
_block: T.proc.params(io: IO).void,
|
_block: T.proc.params(io: IO).void,
|
||||||
).returns(String)
|
).returns(String)
|
||||||
}
|
}
|
||||||
def self.popen_write(arg0, *args, safe: false, **options, &_block)
|
def self.popen_write(*args, safe: false, **options, &_block)
|
||||||
output = ""
|
output = ""
|
||||||
popen(args, "w+b", options) do |pipe|
|
popen(args, "w+b", options) do |pipe|
|
||||||
# Before we yield to the block, capture as much output as we can
|
# Before we yield to the block, capture as much output as we can
|
||||||
@ -69,13 +66,12 @@ module Utils
|
|||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
arg0: T.any(String, T::Hash[String, String]),
|
args: T.any(String, T::Hash[String, String]),
|
||||||
args: String,
|
|
||||||
options: Symbol,
|
options: Symbol,
|
||||||
block: T.nilable(T.proc.params(io: IO).void),
|
block: T.nilable(T.proc.params(io: IO).void),
|
||||||
).returns(String)
|
).returns(String)
|
||||||
}
|
}
|
||||||
def self.safe_popen_write(arg0, *args, **options, &block)
|
def self.safe_popen_write(*args, **options, &block)
|
||||||
popen_write(*args, safe: true, **options, &block)
|
popen_write(*args, safe: true, **options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user