Skip to content

Commit 4a91208

Browse files
committed
Prettier loops binary
1 parent 8fff7a4 commit 4a91208

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bin/loops

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/usr/bin/env ruby
2-
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
32

4-
require File.dirname(__FILE__) + '/../lib/loops'
3+
# Add our lib dir to the load path
4+
loops_lib_dir = File.dirname(__FILE__) + '/../lib'
5+
$LOAD_PATH.unshift(loops_lib_dir) unless $LOAD_PATH.include?(loops_lib_dir)
6+
7+
# Load loops
8+
require 'loops'
59

610
begin
711
# The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
812
failure = Loops::CLI.execute
913
Kernel.exit(failure ? 1 : 0)
14+
1015
rescue SystemExit => e
1116
Kernel.exit(e.status)
17+
1218
rescue Exception => e
1319
STDERR.puts("Unhandled exception: #{e.message} (#{e.class})")
1420
STDERR.puts(e.backtrace.join("\n"))

0 commit comments

Comments
 (0)