Change how ruby executes commands

This commit is contained in:
spengreb 2019-10-08 22:14:42 +02:00
parent f2738686d5
commit c893e37a65

View file

@ -5,7 +5,7 @@ class VouchersController < ApplicationController
# GET /vouchers
def index
@vouchers = Voucher.all
whitelist = %x[mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} 'whitelist list' | sed 's/There are*.*whitelisted players: //g'].gsub("\n", "").split(", ")
whitelist = system 'mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist list" | sed "s/There are*.*whitelisted players: //g"'.gsub("\n", "").split(", ")
render json: { :vouchers => @vouchers, :whitelist => whitelist }.to_json
end