F
Fara Nasr
Hello everyone
I urgently some help with this code. I am trying to implement the
following pipeline and i keep getting this error Erro:ENOENT
can anybody please help me to get this code working
#input is the command line
def handleCommandLine(input)
# it splits the pipeline into an array
command = input.split('|').map{|c|word_list(c)}
i = 0
while i< command.length
commands = command.at(i)
execute(commands)
i +=1
end
end
def execute(commands)
rd, wr = IO.pipe
if fork.nil?
# child
rd.close
$stdout.reopen(wr)
wr.close
exec(*commands)
exit
else
# parent
wr.close
$stdin.reopen(rd)
rd.close
end
end
I urgently some help with this code. I am trying to implement the
following pipeline and i keep getting this error Erro:ENOENT
can anybody please help me to get this code working
#input is the command line
def handleCommandLine(input)
# it splits the pipeline into an array
command = input.split('|').map{|c|word_list(c)}
i = 0
while i< command.length
commands = command.at(i)
execute(commands)
i +=1
end
end
def execute(commands)
rd, wr = IO.pipe
if fork.nil?
# child
rd.close
$stdout.reopen(wr)
wr.close
exec(*commands)
exit
else
# parent
wr.close
$stdin.reopen(rd)
rd.close
end
end