Class: AssLauncher::Support::Shell::RunAssResult Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ass_launcher/support/shell.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Contain result for execute 1C binary see ProcessHolder#result

Defined Under Namespace

Classes: RunAssError, UnexpectedAssOut

Constant Summary collapse

CUT_ASSOUT_LENGTH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

640

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exitstatus, out, err, assout) ⇒ RunAssResult

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RunAssResult.



323
324
325
326
327
328
# File 'lib/ass_launcher/support/shell.rb', line 323

def initialize(exitstatus, out, err, assout)
  @err = err
  @out = out
  @exitstatus = exitstatus
  @assout = assout
end

Instance Attribute Details

#assoutObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



321
322
323
# File 'lib/ass_launcher/support/shell.rb', line 321

def assout
  @assout
end

#errObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



321
322
323
# File 'lib/ass_launcher/support/shell.rb', line 321

def err
  @err
end

#exitstatusObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



321
322
323
# File 'lib/ass_launcher/support/shell.rb', line 321

def exitstatus
  @exitstatus
end

#expected_assoutObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



322
323
324
# File 'lib/ass_launcher/support/shell.rb', line 322

def expected_assout
  @expected_assout
end

#outObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



321
322
323
# File 'lib/ass_launcher/support/shell.rb', line 321

def out
  @out
end

Instance Method Details

#expected_assout?Boolean

Note:

Sometimes 1C does what we not expects. For example, we ask to create InfoBase File=“tmptmp.ib” however 1C make files of infobase in root of ‘tmp' directory and exits with status 0. In this case we have to check assout for answer executed success? or not.

Checkin #assout string If existstatus != 0 checking assout value skiped and return true It work when exitstatus == 0 but taken unexpected assout

Returns:

  • (Boolean)


374
375
376
377
378
# File 'lib/ass_launcher/support/shell.rb', line 374

def expected_assout?
  return true if expected_assout.nil?
  return true if exitstatus != 0
  ! (expected_assout =~ assout).nil?
end

#success?Boolean

Returns:

  • (Boolean)


350
351
352
# File 'lib/ass_launcher/support/shell.rb', line 350

def success?
  exitstatus == 0 && expected_assout?
end

#verify!Object

Verivfy of result and raises unless #success?

Raises:

  • (UnexpectedAssOut)
    • exitstatus == 0 but taken unexpected

    assout AssLauncher::Support::Shell::RunAssResult.!!#expected_assout?

  • (RunAssError)
    • if other errors taken



335
336
337
338
339
# File 'lib/ass_launcher/support/shell.rb', line 335

def verify!
  fail UnexpectedAssOut, cut_assout unless expected_assout?
  fail RunAssError, "#{err}#{cut_assout}" unless success?
  self
end