System 'bash -ic' stuck when I hit ctrl+c

196 Views Asked by At

When i try system 'bash -ic', and terminate it in terminal, I stuck, following is my code

# ~/.bashrc
alias sv='sudo service'


# ex.rb
system "bash -ic 'sv'"
sleep
# in terminal, hit ctrl+c, it stuck

But when i try following code, it doesn't stuck

system "bash -ic 'source ~/.bashrc; sv'"
sleep
# in terminal, hit ctrl+c, it doesn't stuck

I reproduce my question in screencast

my question is why does it stuck?

update

here is my bashrc

0

There are 0 best solutions below